package com.example.liang.basamovie.activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
import com.example.liang.basamovie.R;
public class WebPlayerActivity extends AppCompatActivity {
    ImageView back;
    WebView webView;
    VideoView videoView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_player);
        back= (ImageView) findViewById(R.id.toolbar_back);
        webView= (WebView) findViewById(R.id.web_player);
        videoView= (VideoView) findViewById(R.id.video_player);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        Intent intent=getIntent();
        String url=intent.getStringExtra("url");
        webView.loadUrl(url);
        String videourl=intent.getStringExtra("videourl");
        videoView.setVideoURI(Uri.parse(videourl));
        MediaController mediaController = new MediaController(this);
        videoView.setMediaController(mediaController);
        videoView.start();
        Toast.makeText(this,"请客官稍等片刻，视频即将加载完毕播放",Toast.LENGTH_SHORT).show();
    }
}
